package com.ruoyi.web.controller.tube;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.tube.domain.Sgcddy;
import com.ruoyi.tube.service.ISgcddyService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 束管-基本信息Controller
 * 
 * @author ruoyi
 * @date 2024-10-31
 */
@RestController
@RequestMapping("/control/sgcddy")
public class SgcddyController extends BaseController
{
    @Autowired
    private ISgcddyService sgcddyService;

    /**
     * 查询束管-基本信息列表
     */
    @PreAuthorize("@ss.hasPermi('control:sgcddy:list')")
    @GetMapping("/list")
    public TableDataInfo list(Sgcddy sgcddy)
    {
        startPage();
        List<Sgcddy> list = sgcddyService.selectSgcddyList(sgcddy);
        return getDataTable(list);
    }

    /**
     * 导出束管-基本信息列表
     */
    @PreAuthorize("@ss.hasPermi('control:sgcddy:export')")
    @Log(title = "束管-基本信息", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, Sgcddy sgcddy)
    {
        List<Sgcddy> list = sgcddyService.selectSgcddyList(sgcddy);
        ExcelUtil<Sgcddy> util = new ExcelUtil<Sgcddy>(Sgcddy.class);
        util.exportExcel(response, list, "束管-基本信息数据");
    }

    /**
     * 获取束管-基本信息详细信息
     */
    @PreAuthorize("@ss.hasPermi('control:sgcddy:query')")
    @GetMapping(value = "/{sgcddyId}")
    public AjaxResult getInfo(@PathVariable("sgcddyId") String sgcddyId)
    {
        return success(sgcddyService.selectSgcddyBySgcddyId(sgcddyId));
    }

    /**
     * 新增束管-基本信息
     */
    @PreAuthorize("@ss.hasPermi('control:sgcddy:add')")
    @Log(title = "束管-基本信息", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody Sgcddy sgcddy)
    {
        return toAjax(sgcddyService.insertSgcddy(sgcddy));
    }

    /**
     * 修改束管-基本信息
     */
    @PreAuthorize("@ss.hasPermi('control:sgcddy:edit')")
    @Log(title = "束管-基本信息", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody Sgcddy sgcddy)
    {
        return toAjax(sgcddyService.updateSgcddy(sgcddy));
    }

    /**
     * 删除束管-基本信息
     */
    @PreAuthorize("@ss.hasPermi('control:sgcddy:remove')")
    @Log(title = "束管-基本信息", businessType = BusinessType.DELETE)
	@DeleteMapping("/{sgcddyIds}")
    public AjaxResult remove(@PathVariable String[] sgcddyIds)
    {
        return toAjax(sgcddyService.deleteSgcddyBySgcddyIds(sgcddyIds));
    }
}
